<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>promise</title>
	</head>
	<body>
		<script type="text/javascript">
			
//			Promise
			let myPro = new Promise((resolve,reject)=>{
				let xhr = new XMLHttpRequest();
				xhr.open(method,url);
				xhr.addEventListener("readystatechange",()=>{
					if(xhr.readyState == 4){
						if(xhr.status == 200){
							resolve("吕昭")
						}
					}
				})
				xhr.send();
			});
			myPro.then((res)=>{
				console.log(res);
			}).catch((err)=>{
				console.log("失败",err)
			})
		</script>
	</body>
</html>
